package com.bjc.sdx.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import com.bjc.sdx.R;

public class MainActivity2 extends Activity implements View.OnClickListener {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button btn = (Button) findViewById(R.id.btn);
        btn.setOnClickListener(this);
        Log.i("MainActivity", "B----onCreate()");
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.i("MainActivity", "B----onStart()");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.i("MainActivity", "B----onRestart()");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.i("MainActivity", "B----onResume()");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.i("MainActivity", "B----onPause()");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.i("MainActivity", "B----onStop()");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.i("MainActivity", "B----onDestroy()");
    }

    public void click() {
        //创建一个Intent对象，通过该对象开启第2个Activity
        Intent intent = new Intent(this, Activity02.class);
        startActivity(intent);
    }

    @Override
    public void onClick(View arg0) {
        click();
    }
}